package com.ks.service;

import com.ks.base.BaseService;
import com.ks.dao.ProfessionDao;
import com.ks.dao.StudentQuestionDao;
import com.ks.entity.Profession;
import com.ks.entity.StudentQuestion;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("studentQuestionService")
public class StudentQuestionService<T> extends BaseService<T> {
    private final static Logger log = Logger.getLogger(StudentQuestionService.class);

    @Autowired
    private StudentQuestionDao<T> dao;

    public StudentQuestionDao<T> getDao() {
        return dao;
    }

    public void wrongAjax(StudentQuestion studentQuestion){
        List<StudentQuestion> studentQuestions = dao.findByQuestionId(studentQuestion.getQuestion_id());
        if(studentQuestions.size()==0){
            dao.add(studentQuestion);
        }
    }

    public Integer findCountJoinContent(Object o){
        return dao.findCountJoinContent(o);
    }

    public Integer findCountJoinContentCorrect(Object o){
        return dao.findCountJoinContentCorrect(o);
    }

}
